home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch13 / Orth.frm (.txt) < prev    next >
Visual Basic Form  |  1999-06-19  |  5KB  |  169 lines

  1. VERSION 5.00
  2. Begin VB.Form frmOrth 
  3.    Appearance      =   0  'Flat
  4.    AutoRedraw      =   -1  'True
  5.    BackColor       =   &H00C0C0C0&
  6.    Caption         =   "Orth"
  7.    ClientHeight    =   5895
  8.    ClientLeft      =   2100
  9.    ClientTop       =   525
  10.    ClientWidth     =   4530
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    LinkTopic       =   "Form1"
  22.    PaletteMode     =   1  'UseZOrder
  23.    ScaleHeight     =   5895
  24.    ScaleWidth      =   4530
  25.    Begin VB.PictureBox picSide 
  26.       AutoRedraw      =   -1  'True
  27.       Height          =   1935
  28.       Left            =   1965
  29.       ScaleHeight     =   -5.639
  30.       ScaleLeft       =   -4
  31.       ScaleMode       =   0  'User
  32.       ScaleTop        =   4
  33.       ScaleWidth      =   5.639
  34.       TabIndex        =   3
  35.       Top             =   1965
  36.       Width           =   1935
  37.    End
  38.    Begin VB.PictureBox picFront 
  39.       AutoRedraw      =   -1  'True
  40.       Height          =   1935
  41.       Left            =   0
  42.       ScaleHeight     =   -5.639
  43.       ScaleLeft       =   -2
  44.       ScaleMode       =   0  'User
  45.       ScaleTop        =   4
  46.       ScaleWidth      =   5.639
  47.       TabIndex        =   2
  48.       Top             =   3930
  49.       Width           =   1935
  50.    End
  51.    Begin VB.PictureBox picTop 
  52.       AutoRedraw      =   -1  'True
  53.       Height          =   1935
  54.       Left            =   0
  55.       ScaleHeight     =   -5.639
  56.       ScaleLeft       =   -2
  57.       ScaleMode       =   0  'User
  58.       ScaleTop        =   2
  59.       ScaleWidth      =   5.639
  60.       TabIndex        =   1
  61.       Top             =   0
  62.       Width           =   1935
  63.    End
  64.    Begin VB.PictureBox picNormal 
  65.       AutoRedraw      =   -1  'True
  66.       Height          =   1935
  67.       Left            =   0
  68.       ScaleHeight     =   -4
  69.       ScaleLeft       =   -1.5
  70.       ScaleMode       =   0  'User
  71.       ScaleTop        =   2.5
  72.       ScaleWidth      =   4
  73.       TabIndex        =   0
  74.       Top             =   1965
  75.       Width           =   1935
  76.    End
  77.    Begin VB.Label Label1 
  78.       Caption         =   "Side"
  79.       Height          =   255
  80.       Index           =   3
  81.       Left            =   3960
  82.       TabIndex        =   6
  83.       Top             =   2760
  84.       Width           =   615
  85.    End
  86.    Begin VB.Label Label1 
  87.       Caption         =   "Front"
  88.       Height          =   255
  89.       Index           =   1
  90.       Left            =   2040
  91.       TabIndex        =   5
  92.       Top             =   4800
  93.       Width           =   735
  94.    End
  95.    Begin VB.Label Label1 
  96.       Caption         =   "Top"
  97.       Height          =   255
  98.       Index           =   0
  99.       Left            =   2040
  100.       TabIndex        =   4
  101.       Top             =   720
  102.       Width           =   615
  103.    End
  104. Attribute VB_Name = "frmOrth"
  105. Attribute VB_GlobalNameSpace = False
  106. Attribute VB_Creatable = False
  107. Attribute VB_PredeclaredId = True
  108. Attribute VB_Exposed = False
  109. Option Explicit
  110. ' Location of viewing eye.
  111. Private EyeR As Single
  112. Private EyeTheta As Single
  113. Private EyePhi As Single
  114. ' Location of focus point.
  115. Private Const FocusX = 0#
  116. Private Const FocusY = 0#
  117. Private Const FocusZ = 0#
  118. Private Projector(1 To 4, 1 To 4) As Single
  119. Private Sub Form_Load()
  120. Dim M(1 To 4, 1 To 4) As Single
  121.     ' Initialize the eye position.
  122.     EyeR = 3
  123.     EyeTheta = PI * 0.37
  124.     EyePhi = PI * 0.1
  125.     ' Create the data.
  126.     CreateData
  127.     ' Create the projection matrix.
  128.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  129.     ' Draw the data.
  130.     TransformAllData Projector
  131.     DrawAllData picNormal, ForeColor, True
  132.     m3OrthoTop M
  133.     TransformAllData M
  134.     DrawAllData picTop, ForeColor, True
  135.     m3OrthoFront M
  136.     TransformAllData M
  137.     DrawAllData picFront, ForeColor, True
  138.     m3OrthoSide M
  139.     TransformAllData M
  140.     DrawAllData picSide, ForeColor, True
  141. End Sub
  142. ' Create the object to display.
  143. Private Sub CreateData()
  144. '   MakeSegment 0, 0, 0, 2, 0, 0    ' Hidden.
  145.     MakeSegment 2, 0, 0, 2, 1, 0
  146.     MakeSegment 2, 1, 0, 1, 1, 0
  147.     MakeSegment 1, 1, 0, 1, 2, 0
  148.     MakeSegment 1, 2, 0, 0, 2, 0
  149. '   MakeSegment 0, 0, 0, 0, 0, 2    ' Hidden.
  150.     MakeSegment 0, 0, 2, 0, 1, 2
  151.     MakeSegment 0, 1, 2, 0, 1, 1
  152.     MakeSegment 0, 1, 1, 0, 2, 1
  153.     MakeSegment 0, 2, 1, 0, 2, 0
  154. '   MakeSegment 0, 0, 0, 2, 0, 0    ' Hidden.
  155.     MakeSegment 2, 0, 0, 2, 0, 1
  156.     MakeSegment 2, 0, 1, 1, 0, 1
  157.     MakeSegment 1, 0, 1, 1, 0, 2
  158.     MakeSegment 1, 0, 2, 0, 0, 2
  159.     MakeSegment 0, 1, 1, 2, 1, 1
  160.     MakeSegment 1, 0, 1, 1, 2, 1
  161.     MakeSegment 1, 1, 0, 1, 1, 2
  162.     MakeSegment 2, 1, 0, 2, 1, 1
  163.     MakeSegment 2, 1, 1, 2, 0, 1
  164.     MakeSegment 0, 2, 1, 1, 2, 1
  165.     MakeSegment 1, 2, 1, 1, 2, 0
  166.     MakeSegment 0, 1, 2, 1, 1, 2
  167.     MakeSegment 1, 1, 2, 1, 0, 2
  168. End Sub
  169.